<template>
  <div id="enterprise" :class="{'isPc':fun.isPc()}">
    <c-title :hide="false" :text="'企业管理'"></c-title>
    <van-tabs v-model="active">
      <van-tab title="企业列表" name="index"></van-tab>
      <van-tab title="商务服务" name="services"></van-tab>
    </van-tabs>
    <keep-alive>
      <components :is="active"></components>
    </keep-alive>
    <div class="btn">
      <van-button color="#daa032" @click="handle">添加企业</van-button>
    </div>
  </div>
</template>

<script>
import index from "./components/business-management/index";
export default {
  components:{
    index,
    services:()=>import("./components/business-management/services")
  },
  data() {
    return {
      active:"index",
      current_statue: true,
      name: "",
      logo: "",
      httpUrl:"plugin.lawyer-platform.frontend.controllers.business.getBusiness",
    };
  },
  methods: {
    to(){
      console.log(this.$route.query)
      this.$router.push({path:"/diyform/1",query:{...this.$route.query}})
    },
    edit(id){
      this.$router.push(this.fun.getUrl("enterpriseEdit",{id}));
    },
    handle() {
      this.$router.push(this.fun.getUrl("enterpriseAdd"));
    },
    del_enterprise({name,id},i) {
      this.$dialog.confirm({
        title: '删除',
        message: '是否删除' + name,
      }).then(res=>{
        $http.post("plugin.lawyer-platform.frontend.controllers.business.delete",{id}).then(({result,msg})=>{
          if(result) this.listData.splice(i,1);
          this.$toast(msg);
        })
      })
    }
  }
};
</script>

<style lang="scss" scoped>
.isPc {
  max-width: 375px;
}

.main {
  padding: 1rem;
}

.serve {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;

  ::v-deep .van-button {
    width: 3.9rem;
    height: 1.5rem;
    border-radius: 0.8rem;
    color: #daa032;
    border: solid 1px #daa032;
  }
}

.flex {
  display: flex;
}

.align-items-center {
  align-items: center;
}

.name {
  margin-left: 0.571rem;
  font-size: 1rem;
}

#enterprise {
  position: relative;
  height: 100vh;
  background: #fff;

  .info {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
  }

  ::v-deep .van-tabs__line {
    background-color: #daa032;
  }

  ::v-deep .van-tab--active {
    color: #daa032 !important;
  }

  .btn {
    position: absolute;
    width: 100%;
    bottom: 0;
    background-color: #fff;
    box-shadow: 0 -2px 7px 0 rgba(213, 213, 213, 0.59);
    padding: 0.5714rem 1.7857rem;

    ::v-deep .van-button--normal {
      width: 100%;
      border-radius: 0.3571rem;
    }
  }
}

img {
  margin: 0;
  width: 2rem;
  height: 2rem;
  object-fit: cover;
  border-radius: 100px;
}

.operation {
  display: flex;

  span {
    width: 2rem;
    height: 2rem;
    line-height: 2rem;
    border-radius: 100px;
    background-color: #fdf1cf;
  }
}

.mr-1 {
  margin-right: 1rem;
}

i.iconfont {
  color: #daa032;
  font-size: 1rem;
}
</style>
